package com.fsgom.common.util;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class FileListMakerUtils {
	
	private String imageBaseUrl;

	public String getImageBaseUrl() {
		return imageBaseUrl;
	}
	
	public void setImageBaseUrl(String imageBaseUrl) {
		this.imageBaseUrl = imageBaseUrl;
	}

	public List<String> getFilesFullPath(List<String> fileLst) {
		List<String> pathLst = new ArrayList<String>();
		for (String fileNm : fileLst) {
			pathLst.add(getImageBaseUrl() + "/" + fileNm);
		}
		return pathLst;
	}

	public List<String> getFileList(String targetPath) {
		File path = new File(targetPath);
		if (path.isDirectory()) {
			List<String> fileLst = new ArrayList<String>();
			String[] fl = path.list();
			File tmpFile = null;
			for (int i=0 ; i<fl.length ; i++) {
				String fileNm = fl[i];
				tmpFile = new File(path.getAbsolutePath()+ "/" + fileNm);
				if (!tmpFile.isDirectory()) {
					fileLst.add(fileNm);
				}
			}
			return fileLst;	
		}
		return new ArrayList<String>();
	}
	
	
	
}
